var express = require('express');
const { response } = require('../app');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

//处理login的请求
router.post("/login",(req,res)=>{
    //获取客户端传递过来的参数 get
    //console.log(req.query.username,req.query.pwd);
    //获取客户端传递过来的参数 post
    console.log(req.body.username,req.body.pwd);
    if(req.body.username==='aaa'&&req.body.pwd==='111' ){
            res.redirect("/page/success.html");
    }else{
      res.redirect("/page/error.html");
    }
})


module.exports = router;
